package com.ljj;

import com.ljj.util.PdfConverUtil;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class Test {
    public static void main(String[] args) {
// imgae to pdf
//        try {
//            FileInputStream inputStream = new FileInputStream("D:\\testConvert\\银行卡.jpg");
//            FileOutputStream byteArrayOutputStream = new FileOutputStream("D:\\testConvert\\银行卡.pdf");
//            com.ljj.util.PdfConverUtil.imgToPdf(inputStream, byteArrayOutputStream);
//
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }

        // doc/docx to pdf
        try {
            FileInputStream inputStream = new FileInputStream("D:/upload/645e5fe2-3a42-4b79-b381-4a9dd05bf89f.docx");
            FileOutputStream byteArrayOutputStream = new FileOutputStream("D:/upload/645e5fe2-3a42-4b79-b381-4a9dd05bf89f.pdf");
            PdfConverUtil.wordTopdfByAspose(inputStream, byteArrayOutputStream);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        // execl to pdf
//        try {
//            FileInputStream inputStream = new FileInputStream("D:\\testConvert\\zyyexcel.xls");
//            FileOutputStream byteArrayOutputStream = new FileOutputStream("D:\\testConvert\\zyyexcel.pdf");
//            com.ljj.util.PdfConverUtil.excelToPdf(inputStream, byteArrayOutputStream);
//
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }

        // ppt tp pdf
//        try {
//            FileInputStream inputStream = new FileInputStream("D:\\testConvert\\zyy123ppt.ppt");
//            FileOutputStream byteArrayOutputStream = new FileOutputStream("D:\\testConvert\\zyy123pptnew.pdf");
//            com.ljj.util.PdfConverUtil.pptToPdf(inputStream, byteArrayOutputStream);
//
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }

        // pptx to pdf
//        try {
//            FileInputStream inputStream = new FileInputStream("D:\\testConvert\\zyypptx.pptx");
//            FileOutputStream byteArrayOutputStream = new FileOutputStream("D:\\testConvert\\zyypptxnew.pdf");
//            com.ljj.util.PdfConverUtil.pptxToPdf(inputStream, byteArrayOutputStream);
//
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    }
}
